<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.box {
				position: relative;
				width: 400px;
				border-bottom: 1px solid gray;
				margin: 100px auto;
			}

			.box input {
				width: 370px;
				height: 30px;
				border: 0;
				outline: none;
			}

			.box img {
				position: absolute;
				top: 2px;
				right: 2px;
				width: 24px;

			}
		</style>
	</head>
	<body>
		<div class="box">
			<label>
				<img src="img/close.png" id="eye">
			</label>
			<input type="password" name="" id="pwd" value="" /><label for=""></label>

		</div>
		<script type="text/javascript">
			var eye = document.getElementById('eye');
			var pwd = document.getElementById('pwd');
			var flag = 0;
			eye.onclick = function() {
				if (flag == 0) {
					pwd.type = 'text';
					flag = 1;
					eye.src='img/open.png'
				} else {
					pwd.type = 'password';
					flag = 0;
					eye.src='img/close.png';
				}
			}
		</script>
	</body>
</html>
